import io from 'socket.io-client'
import Vue from 'vue'

export let socket = null
// 断开websocket
export function socketDisConn() {
  if (socket) socket.close()
}
// 连接socket函数
export function createConn() {
  socket = io(window.location.host, {
    path: '/api/socket.io'
  })
  Vue.prototype.$socket = socket
}
